import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/todolist.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home
    },
]

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    if (typeof (location) == "string") {
        var Separator = "&";
        if (location.indexOf('?') == -1) {
            Separator = '?';
        }
        location = location + Separator + "random=" + Math.random();
    }
    return routerPush.call(this, location).catch(error => error)
}

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
